Skip to content

test_runner: apply run() name filters with isolation none#64376

Open
UditDewan wants to merge 1 commit into
nodejs:mainfrom
UditDewan:fix-run-isolation-none-patterns
Open

test_runner: apply run() name filters with isolation none#64376
UditDewan wants to merge 1 commit into
nodejs:mainfrom
UditDewan:fix-run-isolation-none-patterns

Conversation

@UditDewan

Copy link
Copy Markdown

Problem

run() validates testNamePatterns and testSkipPatterns and forwards them to spawned processes as --test-name-pattern/--test-skip-pattern flags, but never applies them to the root test's configuration. With isolation: 'none' there are no spawned processes β€” the test files are imported into the current process β€” so both options were silently ignored and every test ran.

The same filters do work as CLI flags under --test-isolation=none because the test runner entry point passes the memoized parseCommandLine() options object to run(), which spreads it into the root configuration.

Fix

Apply the validated patterns to the root test configuration when isolation is 'none'.

Doing only that would break watch mode with isolation: 'none', where a file level test with an empty name wraps the single spawned process: the name filter would reject it and no test would ever run. The equivalent breakage is observable today on the CLI, where node --test --watch --test-isolation=none --test-name-pattern=... runs nothing. Since a FileTest represents a test file rather than a named test β€” the patterns are applied to the tests inside the file by the spawned process β€” it is now exempt from name filtering, like TestHook already is.

Fixes: #64359

The testNamePatterns and testSkipPatterns options of run() were only
forwarded to spawned processes as CLI flags, so they were silently
ignored when isolation was 'none' and tests ran in the current
process. Apply the validated patterns to the root test configuration
in that case.

Exempt file level tests from name filtering: they represent test
files rather than named tests, and filtering them prevented any test
from running in watch mode when the root configuration contained name
patterns.

Fixes: nodejs#64359
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/test_runner

@nodejs-github-bot nodejs-github-bot added needs-ci PRs that need a full CI run. test_runner Issues and PRs related to the test runner subsystem. labels Jul 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-ci PRs that need a full CI run. test_runner Issues and PRs related to the test runner subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Test Runner] run() ignores testNamePatterns / testSkipPatterns when `isolation: 'none'

2 participants